package org.example.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import jakarta.annotation.Resource;
import org.example.bean.School;
import org.example.mapper.SchoolMapper;
import org.example.service.SchoolService;
import org.example.util.JsonResult;
import org.example.util.ResultTool;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;

/**
 * @Auther:Liu
 * @Testname:SchoolServiceImpl
 * @Date:2025/9/9 13:24
 */
@Service
public class SchoolServiceImpl extends ServiceImpl<SchoolMapper, School> implements SchoolService {
   @Resource
   private SchoolMapper schoolMapper;
    @Override
    public JsonResult SaveSchool(School school) {
        save(school);
        return ResultTool.success("添加成功");
    }

    @Cacheable(cacheNames = "findById")
    public JsonResult findById(String id) {
        School school = schoolMapper.selectById(id);
        return ResultTool.success(school);
    }
}
